import {Comm} from "../utils/common.js";
class Message extends Comm{
  constructor(){
    super();
    this.getMessageData={
      Page:1,
      PageSize:10
    }
  }
  /**
   * 请求消息列表
   */
  getMessages(options){
      this.getMessageData.Page = options.type=="first"?1:this.getMessageData.Page+1;
      return new Promise((resolve,reject)=>{
          let props = {
            url:"/gateway/api/message/list",
            type:"GET",
            data:this.getMessageData,
            sCallBack:res=>{
              resolve(res);
            },
            eCallBack:err=>{
              reject(err);
            }
          }
          this.request(props);
      });
  };
  /**
   * 全部标记为已读
   */
  setRead(){
    return new Promise((resolve,reject)=>{
      let props = {
        url:"/gateway/api/message/setRead",
        sCallBack:res=>{
          resolve(res);
        },
        eCallBack:err=>{
          reject(err);
        }
      }
      this.request(props);
    });
  }
}

export {Message}